package com.wl.shop.service.impl;

import com.wl.shop.entity.MyTemplate;
import com.wl.shop.dao.TemplateDao;
import com.wl.shop.service.TemplateService;
import com.wl.shop.utils.StringUtils;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wangl
 * @since 2017-05-24
 */
@Service("templateService")
@Transactional(readOnly = true)
public class TemplateServiceImpl extends ServiceImpl<TemplateDao, MyTemplate> implements TemplateService {

	@Override
	public void saveOrUpdate(MyTemplate mytemplate) {
		// TODO Auto-generated method stub
		if(StringUtils.isBlank(mytemplate.getId())){
			mytemplate.preInsert();
			insert(mytemplate);
		}else{
			mytemplate.preUpdate();
			updateById(mytemplate);
		}
	}
	
}
